import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { IntroVO, IntroForm, IntroQuery } from '@/api/business/intro/types';

/**
 * 查询服务中心列表
 * @param query
 * @returns {*}
 */

export const listIntro = (query?: IntroQuery): AxiosPromise<IntroVO[]> => {
  return request({
    url: '/business/intro/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询服务中心详细
 * @param id
 */
export const getIntro = (id: string | number): AxiosPromise<IntroVO> => {
  return request({
    url: '/business/intro/' + id,
    method: 'get'
  });
};

/**
 * 新增服务中心
 * @param data
 */
export const addIntro = (data: IntroForm) => {
  return request({
    url: '/business/intro',
    method: 'post',
    data: data
  });
};

/**
 * 修改服务中心
 * @param data
 */
export const updateIntro = (data: IntroForm) => {
  return request({
    url: '/business/intro',
    method: 'put',
    data: data
  });
};

/**
 * 删除服务中心
 * @param id
 */
export const delIntro = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/intro/' + id,
    method: 'delete'
  });
};
